package ssf.app.service;

import java.util.*;

public class FileService extends BaseService {
	// 文件上传
	private static final String SQL_ADD_FILE = "insert into file(fileName,extName,contentType,fileSize,filePath,uploadTime) values(?,?,?,?,?,unix_timestamp())";

	/**
	 * 文件上传
	 */
	public void addFile(String fileName, String extName, String contentType,
			long fileSize, String filePath) {
		jt.update(SQL_ADD_FILE, new Object[] { fileName, extName, contentType,
				fileSize, filePath });
	}

	// 根据ID获得文件信息
	private static final String SQL_GET_FILE_BY_ID = "select * from file where fileId=?";

	/**
	 * 根据ID获得文件信息
	 */
	public Map getFileById(String fileId) {
		return jt.queryForMap(SQL_GET_FILE_BY_ID, new Object[] { fileId });
	}
}
